import * as types from '@/store/mutation-types';

export default {
  [types.SAVE_SHOP_LIST](state, payload) { // 储存商品所有列表
    state.list = payload;
  },

  //* 控制显示operateDialog 显示
  [types.DIALOG_VISIBLE](state, payload) {
    state.dialogVisible = payload;
  },

  [types.SAVE_EVERY_ROW](state, payload) { //* 存住表格里面每一行的信息
    state.rowData = payload;
  },

  [types.SAVE_SHOP_TAGS](state, payload) { //* 存住所有的tags
    state.tagsList = payload.list;
  },

  [types.SAVE_CHOOSE_TAGS](state, payload) { //* 存住选择的tags
    state.chooseTags = payload;
  },

  [types.ADD_CHOOSE_TAGS](state, payload) { //* 存住选择的tags
    if (state.chooseTags.indexOf(payload) === -1) { // 去除重复的值
      state.chooseTags.push(payload);
    }
  },

  //* 存住hours的开门时间
  [types.SAVE_OPEN_TIME](state, payload) {
    state.openTime = payload;
  },

  //* 存住hours的关门时间
  [types.SAVE_END_TIME](state, payload) {
    state.endTime = payload;
  },
};
